package MyCustomTable;

import MyUtil.DataBaseUtil;
import MyUtil.JScrollUtil;
import MyUtil.MyPanel;
import MyUtil.ResultSetTableModel;

import javax.swing.*;
import java.awt.*;
import java.sql.*;

public class Book_restNumber_query extends JFrame{
    private JScrollPane jScrollPane;
    private ResultSet rs;
    public Book_restNumber_query(String sql) throws SQLException {
        super("图书库存查询");
        long number= 0;

        this.setBounds(400,150,700,600);

        JPanel jp = new MyPanel("/picture/3.jpg");
        this.setContentPane(jp);

        jp.setLayout(new FlowLayout());
        rs = DataBaseUtil.produceResultSet(sql);
        jScrollPane = JScrollUtil.getCustomJScrollPane(rs);

        jp.add(jScrollPane);
        while (rs.next()) {
            number += rs.getInt("Bnumber");
        }
        JLabel j1 = new JLabel("总库存为" + String.valueOf(number));
        jp.add(j1);
        this.setVisible(true);

    }

}
